1. Field of the Invention
The present invention generally relates to video decoding, and more particularly, to a motion compensation method and apparatus which can be applied to a video decoding system.
2. Description of the Related Art
Video decoding includes several processes such as entropy decoding, inverse transformation, inverse quantization, and motion compensation. Among these processes, motion compensation requires longer processing time than the other processes. As such, motion compensation involves extracting, from a reference image, common data between a current image and the reference image from the reference image by referring to motion vectors indicating displacement between blocks of the current image and counterpart blocks of the reference image and adding the difference data between the current image and the reference image, which is referred to as residue data, to the extracted common data, which is referred to as motion compensation data, and thereby reconstructing the current image. In motion compensation, a large amount of image data has to be processed and thus the amount of memory access and the amount of computation are also large. Since the amount of processing in motion compensation is proportional to the size of an image, image processing may not be completed within a desired period of time in the worst scenario where the size of the image is significantly large. As a result, smooth video reproduction may not be possible at all.
Most video coder/decoder (codec) engineers prefer implementing a video codec with software to implementing the video codec with hardware because the implementation of the video codec with software hereinafter referred to as a software implementation scheme, can reduce the time and cost required for development, facilitate the reuse of the implemented video codec, and easily correct an error occurring in the implemented video codec due to its high flexibility. However, the core of the video codec is real-time processing. In spite of such advantages, the software implementation scheme may be useless if the implemented video codec cannot process video encoding/decoding in real time. On the other hand, the implementation of the video codec with hardware, hereinafter referred to as a hardware implementation scheme, requires much time and cost for development and the modification of the implemented video codec may be accompanied with the risk of having to change the entire structure of the implemented video codec due to its low flexibility. Above all things, the hardware implementation scheme allows optimization for a target and thus sharply increases the speed of video encoding/decoding as compared to the software implementation scheme.
Due to the reciprocal advantages and disadvantages of the software implementation scheme and the hardware implementation scheme, video codec engineers usually combine these two schemes. In other words, a module constituting a video codec is implemented separately as portions to be processed with software and portions to be processed with hardware according to the characteristics of the portions. In this case, a portion that must be implemented with hardware is motion compensation. Also, processing with software is not suitable for motion compensation since motion compensation requires even more memory access as well as much data computation than other portions.
Image reconstruction is difficult to be processed in real time due to a large amount of computation and an excessively large amount of memory access. To solve this problem, various methods have been used. As one of these methods, processes requiring more computation or memory access than other processes may be implemented with hardware in order to maximize the efficiency of a video codec. A process of generating a prediction frame as a function of a video codec, i.e., a prediction process, occupies a large portion of a video decoding process and requires much memory access. Thus, such prediction process is usually implemented with hardware in order to enhance the performance of the video codec. In a video codec system composed of several modules such as a central processing unit (CPU), a hardware accelerator, and the like, a method for data transmission between modules, the order of the data transmission, and a point of time for the data transmission are key factors in the performance of the video codec system.
In the performance of a video codec system having a hardware accelerator mounted thereon, the performance of the hardware accelerator is a crucial part. In a motion compensation hardware accelerator (MC HWA), all operations of the prediction hardware accelerator are sequentially performed. In other words, the amount of processing time for each macroblock is large. Moreover, a CPU can transmit control information for a new macroblock only after a prediction process for a previous macroblock is finished. Thus, the CPU has to wait until the prediction process for the previous macroblock is finished, and this is a disadvantage in terms of the time required for motion compensation.